<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/5/28
 * Time: 9:16
 */

namespace library\tencent\wechat\wechat_index;


use library\common\arr;
use library\tencent\wechat\admin_wechat\Settings;
use library\tencent\wechat\common\EnterprisePay;
use library\tencent\wechat\common\WechatPay;

abstract class PayManagement extends WechatPay
{

    public static function instance()
    {
        $pay_config=Settings::get('wechat_pay_config');

        $config=array(
            'appid'       => $pay_config['app_id'],
            'mch_id'      => $pay_config['mch_id'],
            'device_info' => null,
            'sign_type'   => 'MD5',
            'md5_key'     => $pay_config['api_key'],
            'notify_url'  => $_SERVER['HTTP_HOST'].'/wechat.php/index/notify/wechat_notify',
        );

//        $config = array(
//            'appid'       => "wx76855fc04264dbe2",
//            'mch_id'      => "1309310601",
//            'device_info' => null,
//            'sign_type'   => 'MD5',
//            'md5_key'     => "0cff7f457b4535b2ebc44bbe13be1652",
//            'notify_url'  => "http://bm.qzzm.com/wechat.php/index/notify/wechat_notify",
//        );
        return new WechatPay($config);
    }

    public static function ent_instance(){
        $pay_config=Settings::get('wechat_pay_config');

        $config=array(
            'mch_appid'       => $pay_config['app_id'],
            'mchid'      => $pay_config['mch_id'],
            'key'=>$pay_config['api_key']
        );
        return new EnterprisePay($config);
    }



}